﻿@using Umbraco.Core;
@using Umbraco.Core.Models;
@using Umbraco.Core.Services
@using KSSOnline.Controller;
@using umbraco.MacroEngines
@inherits umbraco.MacroEngines.DynamicNodeContext
<div class="easyui-panel" style="width:2000px; padding: 5px;">
    เมนู : 
    @{
        DynamicNode contentRoot = new DynamicNode(1071);

        if (Session["Role"] != null)
        {
            var kk = from k in contentRoot.GetChildrenAsList
                     where k.GetProperty("roleAccess").Value.Split(',').Contains(Session["Role"].ToString(), StringComparer.OrdinalIgnoreCase)
                     select k;

            foreach (var item in kk)
            {
                var item2 = item.ChildrenAsList.Where(g => g.GetProperty("roleAccess").Value.Split(',').Contains(Session["Role"].ToString(), StringComparer.OrdinalIgnoreCase));

                string mmId = "#mm" + item.Id;
                string mmIdNoshape = "mm" + item.Id;


                if (item2.Count() > 0)
                {
                    <a href="@item.Url" class="easyui-menubutton" data-options="menu:'@mmId' ">@item.GetPropertyValue("menuCaption")</a>
                    <div id="@mmIdNoshape" style="width:100px;">
                        @foreach (var i2 in item2)
                        {
                            <div><a href="@i2.Url"> @i2.GetPropertyValue("menuCaption")</a></div>
                        }
                    </div>
                }
                else
                {
                    <a href="@item.Url" class="easyui-linkbutton" data-options="plain:true">@item.GetPropertyValue("menuCaption")</a>
                }
            }
        }
}
</div>

@*<li class="active animate5 fadeInUp"><a href="form"><span class="icon-align-justify"></span>KSS Forms</a></li>
    <li class="animate6 fadeInUp"><a href="media.html"><span class="icon-picture"></span>Media</a></li>*@
